//index.js
//获取应用实例
const app = getApp()

Page({
  canvasIdErrorCallback: function (e) {
    console.error(e.detail.errMsg)
  },
  //这里是传数据的
  data: {
    //motto: 'Hello World',
    //userInfo: {},
    //hasUserInfo: false,
    //condition:true,
    //canIUse: wx.canIUse('button.open-type.getUserInfo'),

    showView: true,
    gwView: true,
    jyView: true,
    hiddenLoading: false,

    indexPic: "http://pic2.infocode.com.cn/kv2018/indexPic.jpg",


    //menuArr
    menuArr: [
      { text: "时尚盒子", url: "../fashion/list.wxml" },
      { text: "缤纷春日", url: "../activity/actlist.wxml" },
    ],

    //swiper
    imgUrls: [
      'http://m.dstk.com/images/banner/1015.jpg',
      'http://m.dstk.com/images/banner/1016.jpg',
      'http://m.dstk.com/images/banner/1017.jpg'
    ],
    indicatorDots: false,
    autoplay: false,
    interval: 5000,
    duration: 1000,

    //icoArr
    icoArr: [
      { src: "http://m.dstk.com/images/index/icon_buddha.jpg", text: "诸佛", url: "zfList" },
      { src: "http://m.dstk.com/images/index/icon_gawu.jpg", text: "噶乌", url: "zfList" },
      { src: "http://m.dstk.com/images/index/icon_sale.jpg", text: "特惠", url: "zfList" },
      { src: "http://m.dstk.com/images/index/icon_xianglu.jpg", text: "香炉", url: "zfList" },
      { src: "http://m.dstk.com/images/index/icon_made.jpg", text: "定制", url: "dzNav" },
      { src: "http://m.dstk.com/images/index/icon_knowledge.jpg", text: "唐卡知识", url: "newsList" },
      { src: "http://m.dstk.com/images/index/icon_thousand.jpg", text: "藏传佛教", url: "newsList" },
      { src: "", text: "" }
    ],

    //proArr
    proArr: [
      { url: "ctxtk", src: "../images/proImg.jpg", tit: "彩唐小唐卡大势至菩萨", art: "工艺：彩唐", size: "尺寸：4cm × 5cm", isnew: true },
      { url: "ctxtk", src: "../images/proImg.jpg", tit: "彩唐小唐卡大势至菩萨", art: "工艺：彩唐", size: "尺寸：4cm × 5cm", isnew: true },
      { url: "ctxtk", src: "../images/proImg.jpg", tit: "彩唐小唐卡大势至菩萨", art: "工艺：彩唐", size: "尺寸：4cm × 5cm", isnew: false },
      { url: "ctxtk", src: "../images/proImg.jpg", tit: "彩唐小唐卡大势至菩萨", art: "工艺：彩唐", size: "尺寸：4cm × 5cm", isnew: false }
    ],

    //hdArr
    hdArr: [
      { src: "../images/hdImg.jpg", tit: "2016全球拍卖榜 - 唐卡拍卖价格", bz: "近年来，随着藏传佛教的传播，热爱藏传佛教艺术、收藏藏传佛教艺术品的信众与藏家与日俱增，唐卡..." },
      { src: "../images/hdImg.jpg", tit: "2016全球拍卖榜 - 唐卡拍卖价格", bz: "近年来，随着藏传佛教的传播，热爱藏传佛教艺术、收藏藏传佛教艺术品的信众与藏家与日俱增，唐卡..." }
    ],

    //cityArr
    cityArr: [
      '上海', '北京', '广州', '深圳', '济南', '拉萨', '热贡', '纽约'
    ],

    //saleicoArr
    saleicoArr: [
      { src: "http://m.dstk.com/images/index/handicraft.png", text: "手工精制" },
      { src: "http://m.dstk.com/images/index/value.png", text: "保值增值" },
      { src: "http://m.dstk.com/images/index/return.png", text: "七天包退" },
      { src: "http://m.dstk.com/images/index/deliver.png", text: "送货上门" }
    ],

    //其它单字段
    artTit: "大圣唐卡 · 艺术馆",
    hotTel: "服务热线：400-622-9898",





  },

  /**
   * 监听button点击事件
   */
  listenerButton: function () {
    this.setData({
      hiddenLoading: !this.data.hiddenLoading
    })
  },


  //事件处理函数
  bindViewTap: function () {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  //点击更改状态 - 菜单
  onChangeShowMenu: function () {
    this.setData({
      showView: (!this.data.showView)
    })
  },

  //点击更改状态 - 顾问
  onChangeGW: function () {
    this.setData({
      gwView: (!this.data.gwView),
      jyView: true
    })
  },

  //点击更改状态 - 结缘
  onChangeJY: function () {
    this.setData({
      jyView: (!this.data.jyView),
      gwView: true
    })
  },

  //proArr 链接跳转事伯 - 作品
  ctxtk: function () {
    wx.navigateTo({
      url: '../index/view',
    })
  },


  //icoArr 链接跳转事件 - 诸佛
  zfList: function () {
    wx.navigateTo({
      url: '../index/list'
    })
  },

  //icoArr 链接跳转事件 - 定制
  dzNav: function () {
    wx.navigateTo({
      url: '../index/dz'
    })
  },

  //icoArr 链接跳转事件 - 新闻
  newsList: function () {
    wx.navigateTo({
      url: '../index/newslist',
    })
  },

  onLoad: function (options) {
    // 生命周期函数--监听页面加载
    showView: (options.showView == "true" ? true : false)
    gwView: (options.gwView == "true" ? true : false)
    jyView: (options.jyView == "true" ? true : false)

    //if (app.globalData.userInfo) {
    //  this.setData({
    //    userInfo: app.globalData.userInfo,
    //    hasUserInfo: true
    //  })
    //} else if (this.data.canIUse){
    // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
    // 所以此处加入 callback 以防止这种情况
    //  app.userInfoReadyCallback = res => {
    //    this.setData({
    //      userInfo: res.userInfo,
    //      hasUserInfo: true
    //    })
    //  }
    //} else {
    // 在没有 open-type=getUserInfo 版本的兼容处理
    //  wx.getUserInfo({
    //    success: res => {
    //      app.globalData.userInfo = res.userInfo
    //      this.setData({
    //        userInfo: res.userInfo,
    //        hasUserInfo: true
    //      })
    //    }
    //  })
    //}
  },

  //getUserInfo: function(e) {
  //  console.log(e)
  //  app.globalData.userInfo = e.detail.userInfo
  //  this.setData({
  //    userInfo: e.detail.userInfo,
  //    hasUserInfo: true
  //  })
  //}
})